import request from '@/utils/request'

// 查询报警设备信息列表
export function detailList(query) {
  return request({
    url: '/hospital/warning/list',
    method: 'get',
    params: query
  })
}

// 查询设备列表选项
export function optionDeviceList(query) {
  return request({
    url: '/hospital/warning/optionList',
    method: 'get',
    params: query
  })
}

// 新增报警设备信息
export function addDetail(data) {
  return request({
    url: '/hospital/warning/add',
    method: 'post',
    data: data
  })
}

// 启用/停用报警设备
export function updateStartAndStop(data) {
  return request({
    url: '/hospital/warning/updateStartAndStop',
    method: 'post',
    data: data
  })
}

// 修改报警设备信息
export function updateDetail(data) {
  return request({
    url: '/hospital/warning/update',
    method: 'post',
    data: data
  })
}

// 查询报警设备信息
export function findDetailInfo(id) {
  return request({
    url: '/hospital/warning/' + id,
    method: 'get'
  })
}

// 根据设备地址码查询参数信息
export function getParamList(deviceAddr) {
  return request({
    url: '/hospital/warning/selectParamList/' + deviceAddr,
    method: 'get'
  })
}

// 删除报警设备信息
export function deleteDetail(id) {
  return request({
    url: '/hospital/warning/' + id,
    method: 'delete'
  })
}

// 批量删除报警设备信息
export function deleteBatchDetail(data) {
  return request({
    url: '/hospital/warning/batchDetail',
    method: 'delete',
    data:data
  })
}

// 校验该设备参数是否参与计算
export function checkParticipateInCalculations(data) {
  return request({
    url: '/hospital/warning/checkParticipateInCalculations',
    method: 'get',
    params: data
  })
}

// 批量校验该设备参数是否参与计算
export function batchCheckParticipateInCalculations(data) {
  return request({
    url: '/hospital/warning/batchCheckParticipateInCalculations',
    method: 'get',
    params: data
  })
}

// 根据时间段查询异常数据
export function abnormalDataWithinHalfHour(data) {
  return request({
    url: '/hospital/historyValue/selectAbnormalDataByTimeSlot',
    method: 'get',
    params: data
  })
}
